const path = require('path')
const rootPath = process.cwd()
const merge = require('webpack-merge')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const base = require('./base')
module.exports = merge(base, {
  output: {
    path: rootPath + '/dist/'
  },
  plugins: [
    new CleanWebpackPlugin(
      ['dist/static/js/*', 'dist/static/css/*', 'dist/static/images/*'],
      {
          root: rootPath
      }
    ),
    new CopyWebpackPlugin(
      [
        {
          from: path.join(rootPath, 'src/nobuild/js'),
          to: path.join(rootPath, 'dist/static/js')
        },
        {
          from: path.join(rootPath, 'src/nobuild/css'),
          to: path.join(rootPath, 'dist/static/css')
        }
    ]
  )
  ],
  watchOptions: {
    poll: 1000,
    aggregateTimeout: 500,
    ignored: /node_modles/
  }
})
